Skip to content

2113 nimrod regrid - #2269

Open
BernardClaxton (BernardClaxton) wants to merge 106 commits into
mainfrom
2113_nimrod_regrid
Open

BernardClaxton (BernardClaxton) wants to merge 106 commits into
mainfrom
2113_nimrod_regrid

Conversation

@BernardClaxton

@BernardClaxton BernardClaxton (BernardClaxton) commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Contribution checklist

Aim to have all relevant checks ticked off before merging. See the developer's guide for more detail.

Githib copilot was used to help write some of the tests in test_radar_filter.py.

  • Documentation has been updated to reflect change.
  • New code has tests, and affected old tests have been updated.
  • All tests and CI checks pass.
  • Ensured the pull request title is descriptive.
  • Attributed any Generative AI, such as GitHub Copilot, used in this PR.
  • Marked the PR as ready to review.

@github-actions

github-actions Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor
Total coverage: 93% (HTML report)
Name                                                              Stmts   Miss Branch BrPart  Cover
---------------------------------------------------------------------------------------------------
src/CSET/__init__.py                                                113      4     14      0    97%
src/CSET/_common.py                                                 156      0     54      0   100%
src/CSET/cset_workflow/app/fetch_fcst/bin/fetch_data.py             117     28     26      0    78%
src/CSET/cset_workflow/app/fetch_nimrod/bin/fetch_nimrod.py          85      8     38     16    80%
src/CSET/cset_workflow/app/finish_website/bin/finish_website.py      79      2      8      2    95%
src/CSET/cset_workflow/app/parbake_recipes/bin/parbake.py            29      0      8      0   100%
src/CSET/cset_workflow/app/send_email/bin/send_email.py              25      0      4      0   100%
src/CSET/cset_workflow/lib/python/jinja_utils.py                     17      0      6      0   100%
src/CSET/extract_workflow.py                                        105      1     26      1    98%
src/CSET/graph.py                                                    44      0     14      0   100%
src/CSET/operators/__init__.py                                       89      0     26      0   100%
src/CSET/operators/_atmospheric_constants.py                          9      0      0      0   100%
src/CSET/operators/_colormaps.py                                    250      3     72      4    98%
src/CSET/operators/_stash_to_lfric.py                                 3      0      0      0   100%
src/CSET/operators/_utils.py                                        200      8     74      6    95%
src/CSET/operators/ageofair.py                                      142      7     64      5    94%
src/CSET/operators/aggregate.py                                     184      8     60      7    94%
src/CSET/operators/aviation.py                                       61      0     18      0   100%
src/CSET/operators/collapse.py                                      162      8     80      3    94%
src/CSET/operators/constraints.py                                   115      7     50      2    93%
src/CSET/operators/convection.py                                     38      4     10      2    88%
src/CSET/operators/ensembles.py                                      27      0     14      0   100%
src/CSET/operators/feature.py                                        44      0     10      0   100%
src/CSET/operators/filters.py                                        67      2     30      0    98%
src/CSET/operators/fluxes.py                                         41      0     10      0   100%
src/CSET/operators/humidity.py                                      135      0     52      0   100%
src/CSET/operators/imageprocessing.py                                57      0     16      0   100%
src/CSET/operators/mesoscale.py                                      18      0      2      0   100%
src/CSET/operators/misc.py                                          172      1     72      3    98%
src/CSET/operators/plot.py                                         1174    156    440     71    83%
src/CSET/operators/power_spectrum.py                                156     10     60      8    91%
src/CSET/operators/precipitation.py                                 204      2     92      2    99%
src/CSET/operators/pressure.py                                       41      0     12      0   100%
src/CSET/operators/radar_filter.py                                  111      4     44      4    95%
src/CSET/operators/read.py                                          453     25    200     15    94%
src/CSET/operators/regrid.py                                        147      1     70      3    98%
src/CSET/operators/scoreswrappers.py                                226     22     74      6    89%
src/CSET/operators/temperature.py                                   121      0     32      0   100%
src/CSET/operators/transect.py                                       63      0     24      0   100%
src/CSET/operators/wind.py                                           46      3     10      2    91%
src/CSET/operators/write.py                                          15      0      6      0   100%
src/CSET/recipes/__init__.py                                        104      0     28      0   100%
src/CSET/sample_data/__init__.py                                      0      0      0      0   100%
---------------------------------------------------------------------------------------------------
TOTAL                                                              5445    314   1950    162    93%

Base automatically changed from 1759_import_nimrod to main July 16, 2026 15:39
Comment thread src/CSET/cset_workflow/app/fetch_nimrod/bin/fetch_nimrod.py
title=Produce Nimrod 2D surface plots
description=Produce 2D surface plots of radar observations.
help=Switch to produce 2D surface plots utilising Nimrod radar observations.
Plots are produced of the 2D surface rainfall for each of the selected Nimrod sources.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more precision needed: Nimrod provides rainfall amounts

title=Produce Nimrod radar histograms
description=Produce histograms incorporating radar observations.
help=Switch to produce histograms utilising Nimrod radar observations.
The histograms will combine both model rainfall and radar observations.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will likely change when lfric gives us accumulations as well, but worth being precise her that Nimrod gives as amounts as an accumulation for sum products and a 5min "snapshot" for the other product, whereas the models currently gives us rainfall_rate i.e. amount per time as a snapshot

Comment thread src/CSET/loaders/radar.py
def select_radar_source(input_source_list):
"""Select the preferred radar source from a list of sources."""
# Preference list for Nimrod sources, with most preferred heading the list.
nimrod_preference = ["Nimrod2km", "Nimrodxkm", "Nimrod1km"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs explanation for xkm

Comment thread src/CSET/loaders/radar.py Outdated
Comment thread src/CSET/loaders/radar.py Outdated
# for this is set in v["weights"].
if v["weights"] == "True" and nimrod_weights_exist == "True":
filename_wei_nc = (
f"{nimrod_dir_wei}/{date_use.strftime('%Y%m%d%H%M')}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the radar data are written out with a timepoint in the filename that is shifted by 1hour for the radar_offset. So a file with CYCLE_POINT timestamp in the name is now renamed to CYCLE_POINT+1 in the name while the time coordinates inside have not changed. Is this correct given that the original filename has the endtime in the filename?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to check the filenames written to disk: Do we now have CYCLE_POINT+1 as filename, but time bounds in the file with [CYCLE_POINT-1:CYCLE_POINT]?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have has a look through and left comments/suggestions.

Could you add a description of what this PR is doing?

Have you tested all the different combinations (or as many as possible) of radar type/model?

Comment thread src/CSET/loaders/radar.py
]

# Specify the boundary margin width to use when trimming model fields.
boundary_margin = 16

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be fixed? If not, can it be set by the user?

description=Produce histograms incorporating radar observations.
help=Switch to produce histograms utilising Nimrod radar observations.
The histograms will combine both model rainfall and radar observations.
The model rainfall variable is selected in the Rose tab Diagnostics/Surface (2D) fields.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? Other code suggests rainfall variable is fixed, i.e.
"MODEL_VARNAME": "surface_microphysical_rainfall_rate",

Comment thread src/CSET/loaders/radar.py
Comment thread src/CSET/loaders/radar.py Outdated
Comment thread src/CSET/operators/radar_filter.py Outdated
Comment thread src/CSET/operators/radar_filter.py Outdated
@james-a-f-ross

James Ross (james-a-f-ross) commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

do the recipes maybe belong in their own directory now? e.g recipes/radar or recipes/surface_fields/radar?

Co-authored-by: Sylvia Bohnenstengel <62748926+Sylviabohnenstengel@users.noreply.github.com>
Co-authored-by: Sylvia Bohnenstengel <62748926+Sylviabohnenstengel@users.noreply.github.com>
Comment thread src/CSET/operators/radar_filter.py Outdated
Co-authored-by: Sylvia Bohnenstengel <62748926+Sylviabohnenstengel@users.noreply.github.com>
…plot.yaml

Co-authored-by: Carol Halliwell <150140850+cehalliwell@users.noreply.github.com>
…togram_domain_mean.yaml

Co-authored-by: Carol Halliwell <150140850+cehalliwell@users.noreply.github.com>
…togram_sequence.yaml

Co-authored-by: Carol Halliwell <150140850+cehalliwell@users.noreply.github.com>
@james-a-f-ross

Copy link
Copy Markdown
Collaborator

I have started to make some changes in this branch, some thing I'm not too sure about though.

@jwarner8

James Warner (jwarner8) commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

I've been doing some testing with this branch on Sana's sensitivity experiments over the UK. I had to change the recipe arguments of radar_filter.radar_mask_loop and radar_filter.radar_mask from outputs to required_outputs to get some of the recipes to work (as the operators in radar_filter.py expect required_outputs as the named argument).

The spatial maps of radar seem to work. Model comparisons don't seem to work. Errors I get include;

  • histogram_surface_microphysical_rainfall_rate_case_study_common_domain_model_and_nimrod_radar and histogram_surface_microphysical_rainfall_rate_sequence_plots_common_domain_model_and_nimrod_radar recipes, produce
    Object {obj} cannot be put in a cubelist, as it is not a Cube., traceback to

CSET/src/CSET/operators/radar_filter.py", line 401, in radar_mask_loop filtered_cubes.append(filtered_model)

  • One of the cycles failed from 0221111T0000Z/data/Nimrod5min 'no files found'. I guess we might have just been unlucky with that date if there are no radar obs.

  • The timeseries don't seem to include the radar (domain average)? All other models are there. Are domain averages not supported yet?

  • As above, assume aggregated histograms not supported, as this succeeds and produces model histograms, but no radar on this?

  • Some of the bake tasks are very slow (80 minutes to run), and appear to only be running one task at the end for most of it. Is part of the regridding that expensive and is this expected behaviour?

Comment on lines +133 to +138
if nimrod_field == "Nimrod_comp_xkm":
radar_offset = timedelta(hours=1.0)
if nimrod_field == "Nimrod_comp_1km":
radar_offset = timedelta(hours=1.0)
if nimrod_field == "Nimrod_comp_2km":
radar_offset = timedelta(hours=1.0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could do this witth a Match Case statement too and I feel it's a bit cleaner.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request science Scientific capabilities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nimrod regridding and filtering

6 participants